In a typical client-server networking topology, there are one or more servers that field requests from and send responses to a number of clients. Both the servers and the clients are usually computing devices. For example, in the case of Internet web site hosting, a web site is typically hosted by one or more servers. Clients browsing the web site may issue requests for web site content to the servers, and in response the servers send the web content to the clients. The clients can then display the web site content locally for user viewing.
However, occasionally servers may have to be shut down. Some hardware of the server may not be operating properly, for instance, the server may be scheduled for being upgraded, or the server may be scheduled for routine maintenance. In such situations, it can be important for the server to gracefully shut down. That is, any current connections that the server has with clients are desirably handed off to another server that is to take over for the server that is to be shut down.
Desirably, any current connections that the server to be shutdown has with clients are handed off to the server that is taking over in such a way that the clients are unaware that the handoff is taking place. One approach for one server to take over the connections of another server in this manner is described in the issued U.S. Pat. No. 6,880,013, issued on Apr. 12, 2005, and entitled “Permanent TCP connections across system reboots.” In the approach described in that patent application, the server being shutdown advertises a data window of zero, which is also referred to as a zero data window, or a zero window, and which desirably causes the clients to enter a “persist” state until the server taking over is able to receive data from the clients. In this state, the client periodically sends one byte of data to determine if the window has opened. On receiving an acknowledgement indicating that the data window is still zero, the client repeats this probing again. Only when an acknowledgment is received that the window is greater than zero does the client restart regular transmission of data.
The advertisement of a data window by a server to a client means that the server transmits to the client the amount of data that the client is allowed to send to the server. As the client sends the data, the server receives the data, which is referred to as “filling the window.” Conversely, the window is emptied as an application program running on the server reads the accepted data into its own buffers. A stack on the server, such as a TCP stack, sends back acknowledgements to the application program running on the server to indicate the amount of data that that can be accepted, as a window that is greater than zero.
Advertising a data window of zero, therefore, means that the server is telling the client that the amount of data that the client is allowed to send to the server is zero bytes. In effect, the client is not allowed to send the server any data at all, because if the client were to send even a single byte of data, the amount of data sent would exceed the size of the window. Furthermore, many clients time out the connection and will terminate the connection after multiple retries occur. However, they will not do so if the window is closed, and therefore the clients will periodically continue to retry sending data. This allows the connection to be kept alive.
However, some types of clients do not handle receiving a data window of zero well in an abrupt manner. The maximum size of the window, which is the amount of buffering that the peer allows, is sent at the time of the connection establishment. The client calculates that the server must have had space to accept more data based on the amount of data sent and the original window size. In effect, the client calculates that the window size has been reduced, which is referred to as “window shrinking.” Thus, if a server abruptly advertises a data window of zero, this situation might not be handled well by some clients, causing erroneous behavior, including system crashes. Insofar as the point of advertising a data window of zero is to place the clients in a persist state so that the server's connection with them can be maintained by another server, where the clients prematurely end the connection, this goal is ultimately not achieved.
For these and other reasons, therefore, there is a need for the present invention.